package MonthGame.Ball;

import java.math.BigInteger;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String ans = "";
        BigInteger n = s.nextBigInteger();
        while(n.compareTo(new BigInteger("0"))==1){
            if((n.mod(new BigInteger("2"))).compareTo(new BigInteger("0"))==0){
                n=n.divide(new BigInteger("2"));
                ans+="B";
            }
            else{
                n = n.subtract(new BigInteger("1"));
                ans+="A";
            }
        }for(int i=ans.length()-1;i>=0;i--) System.out.print(ans.charAt(i));
    }
}
